#pragma once
#ifndef __SCENE_NODE_H__
#define __SCENE_NODE_H__

#include "pch.h"
#include "prerequisites.h"
#include "vector4.h"
#include "matrix4x4.h"
#include "quaternion.h"

class c_scene;
class c_scene_node; 
typedef boost::shared_ptr<c_scene_node> scene_node_ptr; 


class c_scene_node : public boost::enable_shared_from_this<c_scene_node> 
{
    friend class c_scene; 
public:
    c_scene_node(c_scene *scene_mgr, const std::string& name); 
    virtual ~c_scene_node(); 

    void set_local_transform(const c_matrix4x4& local_transform);
    c_matrix4x4& get_local_transfrom(); 
    c_matrix4x4 calc_world_transform() const;

    std::string& get_name() { return m_name; }
    
    void set_parent(c_scene_node *parent); 
    c_scene_node* get_parent() const;  
    void add_child_node(const scene_node_ptr& child_node);
    void remove_child_node(scene_node_ptr& child_node);

    virtual bool update(c_scene *scene, const float dt);
    
    /** Renderable 
        TODO: Might be relocate these to a separate class, e.g. c_renderable 
    */  
    virtual void pre_render(c_scene *scene); 
    virtual void render(c_scene *scene);  
    virtual void post_render(c_scene *scene); 

protected:
    
protected:

    typedef std::vector<scene_node_ptr> scene_node_vec_t;

    std::string m_name;
    c_scene_node *m_parent; 
    c_scene *m_scene_mgr;
    scene_node_vec_t m_child_nodes; 
    c_matrix4x4 m_local_transform;  
};



#endif
